/* 
* TODO: 1. Place the .txt data file and the dictionary file you downloaded in the work folder, or enter the full path to these files!
*       2. You may have to increase memory using the 'set mem' statement. It is commented out in the code bellow.
*
* If you have any questions or need assistance contact info@socialexplorer.com.
*/

///set mem 512m
clear all
version 11
set more off
cd "C:\Users\dengh\Dropbox\Yale\Research\APEEP\data\income"
infile using "1970_R12408281.dct", using("1970_R12408281_SL4601.txt") clear

destring FIPS, generate(fips)
ren T004_001 pop
egen income_agg = rowtotal(PT009001-PT009012)
gen income_2000usd = income_agg/pop

keep fips income_2000usd pop
codebook income_2000usd

/*
-----------------------------------------------------------------------------------------------------------------------------
income_2000usd                                                                                                    (unlabeled)
-----------------------------------------------------------------------------------------------------------------------------

                  type:  numeric (double)

                 range:  [2143.1728,22639.835]        units:  1.000e-07
         unique values:  3141                     missing .:  0/3141

                  mean:   10121.8
              std. dev:   2363.02

           percentiles:        10%       25%       50%       75%       90%
                           7167.39   8538.28   10024.5   11534.9     12929

*/


compress
saveold data_income_pop_1970, replace


